<?php

namespace App\Console\Commands;

use App\gen\CurdGenerator;
use Illuminate\Console\Command;
use DB ;

class GenCurd extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'gen:curd {table} {className} {--title=} {--model=} {--view=}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'CURD model';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $table = $this->argument('table') ;
        $colmns = DB::select("SHOW FULL COLUMNS FROM `{$table}`") ;
        CurdGenerator::build($this,$colmns) ;

    }
}
